package com.googlecode.yoohoo.xmppcore.protocol.stream.error;

import junit.framework.Assert;

import org.junit.Test;

import com.googlecode.yoohoo.xmppcore.protocol.XmlLangText;
import com.googlecode.yoohoo.xmppcore.protocol.stanza.error.SimpleApplicationSpecificCondition;

public class StreamErrorTest {
	@Test
	public void xmlNotWellFormed() {
		String xml =
			"<stream:error>" +
				"<xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>" +
				"<text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>" +
					"Some special application diagnostic information!" +
				"</text>" +
				"<escape-your-data xmlns='application-ns'/>" +
			"</stream:error>";
		
		XmlNotWellFormed xmlNotWellFormed = new XmlNotWellFormed();
		xmlNotWellFormed.setText(new XmlLangText("Some special application diagnostic information!", "en"));
		xmlNotWellFormed.setApplicationSpecificCondition(new SimpleApplicationSpecificCondition(
				"escape-your-data", "application-ns"));
		Assert.assertEquals(xml, xmlNotWellFormed.toXml());
	}
}
